<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable('reservation')) { return; }

        Schema::create('reservation', function (Blueprint $table) {
            $table->id()->unique();
            $table->integer('customer_id')->comment('顾客ID');
            $table->integer('teacher_id')->comment('教师ID');
            $table->integer('lessons')->comment('课时，单位：分钟');
            $table->tinyInteger('status')->default(1)->comment('状态，1：未开始，2：进行中，3：已取消，4：已完成');
            $table->integer('subject_id')->comment('学科配置id');
            $table->string('lesson_date')->comment('课程日期');
            $table->integer('lesson_time_id')->comment('课程时段id');
            $table->string('cancel_name')->comment('取消人');
            $table->integer('cancel_time')->comment('取消时间');
            $table->integer('reserve_time')->comment('预约时间');
            $table->string('reserve_name')->comment('预约人');
            $table->creatorId();
            $table->createdAt();
            $table->updatedAt();
            $table->deletedAt();

            $table->engine='InnoDB';
            $table->comment('预约记录表');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('reservation');
    }
};
